package cn.jobstart.controller;
import cn.jobstart.es.service.IResumeEsService;
import cn.jobstart.web.common.SkJsonResult;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.web.bind.annotation.RestController;
import cn.jobstart.pubInter.exception.SkException;
import cn.jobstart.pubInter.IBaseService;
import cn.jobstart.pubInter.RestfulController;
import cn.jobstart.dto.ResumeIntershipDTO;
import cn.jobstart.dto.ResumeIntershipPageDTO;
import cn.jobstart.modelExt.ResumeIntershipExt;
import cn.jobstart.searchExt.ResumeIntershipSearchExt;
import cn.jobstart.service.IResumeIntershipService;
import cn.jobstart.vo.ResumeIntershipDetailVO;
import cn.jobstart.vo.ResumeIntershipListVO;
import cn.jobstart.vo.ResumeIntershipDomainVO;
import cn.jobstart.vo.ResumeIntershipDetailDomainVO;
import cn.jobstart.export.ResumeIntershipDomainExport;
import cn.jobstart.controller.ApiManageController;
import org.springframework.validation.annotation.Validated;
import java.util.Set;
import java.util.HashSet;
import cn.jobstart.pubInter.exception.BusinessException;

/**
*    @author sunke
*    @Date 2023-09-06 15:00:21
*    @description ResumeIntershipController      实习经历
*/
@Api(tags = "人才管理系统-实习经历相关", description = "实习经历相关接口")
@RestController(value ="resumeIntershipRestfulController")
@RequestMapping("/resumeIntership/")
@Validated
public class ResumeIntershipController extends ApiManageController<ResumeIntershipDTO,ResumeIntershipPageDTO,ResumeIntershipExt, ResumeIntershipSearchExt,ResumeIntershipDomainVO,ResumeIntershipDetailDomainVO,ResumeIntershipDetailVO,ResumeIntershipListVO,String> {

	@Resource(name = "resumeIntershipService")
	private IResumeIntershipService resumeIntershipService;



	@Resource
	private IResumeEsService resumeEsService;

	@Override
	public IBaseService<ResumeIntershipExt, ResumeIntershipSearchExt,String> getBaseService() throws SkException {
		return resumeIntershipService;
	}

	@Override
	public void afterPostMod(ResumeIntershipDTO dto, ResumeIntershipExt domain, SkJsonResult<ResumeIntershipDetailVO> jsonResult, HttpServletRequest request, HttpSession session) throws SkException {
		super.afterPostMod(dto, domain, jsonResult, request, session);
		resumeEsService.publishResumeIntershipByResumeId(domain.getResumesId());
	}

	@Override
	public void afterPostAdd(ResumeIntershipDTO dto, ResumeIntershipExt domain, ResumeIntershipDetailVO resumeIntershipDetailVO, HttpServletRequest request, HttpSession session) throws SkException {
		super.afterPostAdd(dto, domain, resumeIntershipDetailVO, request, session);
		resumeEsService.publishResumeIntershipByResumeId(domain.getResumesId());

	}

	@Override
	public String getBaseRoute() {
		return "/resumeIntership/";
	}

	/**
	* 当前模板名称
	* @return
	*/
	@Override
	public String getModelName(){
		return "实习经历";
	}

	@Override
	public Class exportExcelClass() {
		return ResumeIntershipDomainExport.class;
	}

	@Override
	public Set<String> totalMapSet() {
		Set totalMapSet=new HashSet();
		totalMapSet.add("count(resume_intership.ri_id) as countNum");
		return totalMapSet;
	}


}